xfi:format-number

xs:string=xfi:format-number( $value as numeric?, $picture as xs:string)

Last updated on 13-12-2009 at 00:00:00.

Provides an implementation of the XSLT 2.0 format-number function (which is not part of XPath2 functions), in a manner that is compatible with XBRL processors.

The XSLT definition of format-number is at: http://www.w3.org/TR/xslt20/#format-number.

The XSLT definition is applied to the xfi:format-number function except for XSLT's decimal format argument. A processor will obtain any non-default decimal format parameters from its invoking environment (such as the operating system globalization parameters, or a processor invocation globalization parameters). This is to be compatible with generic-message, where the lang attribute selection matches the processor environment settings (and not by specific coding of globalization choices in linkbase or other XBRL resources).

OIM Status

Supported

Parameters

Name Type Details
value numeric? The value argument may be of any numeric data type (xs:double, xs:float, xs:decimal, or their subtypes including xs:integer). Note that if an xs:decimal is supplied, it is not automatically promoted to an xs:double, as such promotion can involve a loss of precision. If the supplied value of the value argument is an empty sequence, the function behaves as if the supplied value were the xs:double value NaN.
picture xs:string The picture string is a sequence of characters, in which the characters assigned to the variables decimal-separator-sign, grouping-sign, zero-digit-sign, digit-sign and pattern-separator-sign are classified as active characters, and all other characters (including the percent-sign and per-mille-sign) are classified as passive characters.

The rules for the picture string are provided in: http://www.w3.org/TR/xslt20/#processing-picture-string.

The analyzing of the picture string is provided in: http://www.w3.org/TR/xslt20/#analysing-picture-string.

Output

Type: xs:string

The formatted number, according to the processing description provided in: http://www.w3.org/TR/xslt20/#formatting-the-number.

Errors

Code Details
xfie:invalidPictureSyntax This error MUST be thrown if the picture string argument does not conform to the format-number rules provided in the XSLT reference above, paragraph 16.4.2, where this error is equivalent to XSLT error XDTE1310.

Conformance suite

90701 xfi.format-number testcase.xml [ download ]

Owners

Name Affiliation Email Start End
Herm Fischer UBMatrix / Mark V Systems fischer@markv.com 13-12-2009 at 00:00:00

Revisions

Name On Details
Herm Fischer 13-12-2009 at 00:00:00 Created the function definition.